package com.etogc.groupchat.login.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.etogc.groupchat.R;
import com.etogc.groupchat.base.BaseActivity;
import com.etogc.groupchat.group.ui.MgrGroupActivity;
import com.etogc.util.IntentHelper;
import com.etogc.util.YcToastHelper;

/**
 * 登录选择页
 * <p>
 * date 2018-3-22
 */
public class LoginSelectActivity extends BaseActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_select);
        findViewById(R.id.tvLogin).setOnClickListener(this);
        findViewById(R.id.tvReg).setOnClickListener(this);
        handleIntent();
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        handleIntent();
    }

    private void handleIntent() {
        Intent intent = getIntent();
        if (intent != null) {
            String type = intent.getStringExtra("TYPE");
            if ("RELOGIN".equals(type)) {
                YcToastHelper.getInstance()._toast("用户账户在其他设备登录");
            }
        }
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tvLogin:
                IntentHelper.jump(LoginSelectActivity.this, LoginActivity.class);
                break;
            case R.id.tvReg:
                jumpReg();
                break;
        }
    }

    private void jumpReg() {
        IntentHelper.jump(this, RegActivity.class, "type", "regist");
    }

}
